package com.level2app.ui.welcome;

import com.level2app.base.BaseActivity;
import com.level2app.base.BaseViewModel;
import com.level2app.databinding.ActivityWelcomeLevel2Binding;
import com.level2app.utils.JumpIntent;
import com.level2app.utils.ToastHelper;

/**
 * 注册并填写姓名后
 */
public class WelcomeLevel2Activity extends BaseActivity<ActivityWelcomeLevel2Binding, BaseViewModel> {

    @Override
    protected BaseViewModel bindModel() {
        return getViewModel(this, BaseViewModel.class);
    }

    @Override
    protected void initInject() {
        getActivityComponent().inject(this);
    }

    @Override
    protected void initData() {
    }

    @Override
    protected void initClick() {
        super.initClick();
        viewModel.onDelayClick(binding.continueBtn, o -> {
            JumpIntent.jumpToMainFinishAll(this);
        });
    }

    // 再点一次退出程序时间设置
    private static final long WAIT_TIME = 2000L;
    private long TOUCH_TIME = 0;
    @Override
    public void onBackPressed() {
        if (System.currentTimeMillis() - TOUCH_TIME < WAIT_TIME) {
            super.onBackPressed();
            finish();
        } else {
            TOUCH_TIME = System.currentTimeMillis();
            ToastHelper.showToast("再次返回退出Level 2");
        }
    }
}